﻿@using KL.Store.Core
@model KL.Store.Web.Models.OrderDetailModel
<div class="content">
    <h1>Sipariş Detayım</h1>
    @if (Model.OrderDetails.Count > 0)
    {
        <div class="cart-info">
            <div class="shop-cart-orders">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td class="name col-xs-4" style="width: 250px">Ürün
                            </td>
                            <td class="priceS col-xs-1">Adet
                            </td>
                            <td class="priceS col-xs-2">Birim Fiyat
                            </td>
                            <td class="priceS col-xs-2">Fiyat
                            </td>
                            <td class="priceS col-xs-1">KDV
                            </td>
                            <td class="totalS col-xs-2" style="border-right: none;">Toplam Tutar
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.OrderDetails)
                        {
                            <tr>
                                <td class="name">
                                    @item.ProductName
                                    @if (!string.IsNullOrEmpty(item.VariantValue))
                                    {
                                        <text>(</text>@item.VariantValue<text>)</text>
                                    }
                                </td>
                                <td class="name">
                                    @item.Amount @item.Unit
                                </td>
                                <td class="name alignright">
                                    @item.UnitPrice.ToString("###,###,##0.00") @item.Curency
                                </td>
                                <td class="name alignright">
                                    @item.Price.ToString("###,###,##0.00") @item.Curency
                                </td>
                                <td class="priceS alignright">
                                    @item.Tax.ToString("###,###,##0.00") @item.Curency
                                </td>
                                <td class="totalS alignright" style="border-right: 0;">
                                    @item.TotalPrice.ToString("###,###,##0.00") @item.Curency
                                </td>
                            </tr>
                        }
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="5"></td>
                            <td class="totalS alignright">
                                @Model.Order.TotalPayment.ToString("###,###,##0.00 TL")
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
            @if (Model.OrderCargoRefs.Count > 0)
            {
                <br />
                <div class="shop-cart">
                    <table>
                        <thead>
                            <tr>
                                <td class="name" style="width: 250px">Kargo Takip Bağlantıları
                                </td>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.OrderCargoRefs)
                            {
                                if (!string.IsNullOrEmpty(item.LinkProduct))
                                {
                                <tr>
                                    <td class="name">
                                        <a href="@item.LinkProduct" target="_blank" class="kargoTakip"><b>Ürün kargo takibi için tıklayınız</b></a>
                                    </td>
                                </tr>
                                }
                                if (!string.IsNullOrEmpty(item.LinkInvoice) && (string.IsNullOrEmpty(item.LinkProduct) || item.LinkProduct != item.LinkInvoice))
                                {
                                <tr>
                                    <td class="name">
                                        <a href="@item.LinkInvoice" target="_blank" class="kargoTakip"><b>Fatura kargo takibi için tıklayınız</b></a>
                                    </td>
                                </tr>
                                }
                            }
                        </tbody>
                    </table>
                </div>
            }
        </div>   
    }
    else
    {
        <div class="bg-info bs-bgb" style="margin-bottom: 15px; color: #000000;">
            <span class="glyphicon glyphicon-info-sign"></span>&nbsp;Hiç ürün bulunamadı.
        </div>
    }
    <a class="btn btn-custom1 right" href="/Order/Index">Geri Dön</a>
    <div class="clearfix"></div>
    @{Html.RenderAction("OurSuggestions", "Partials");}
</div>
<script>
    //$(".kargoTakip").fancybox({
    //    autoScale: true,
    //    fitToView: true,
    //    autoSize: true,
    //    autoDimensions: true,
    //    width: 1000,
    //    height: '100%'
    //});
</script>
